﻿using System;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Example1.Tests
{
    [TestClass]
    public class RouteTests3
    {
        [TestMethod]
        public void TestMethod1()
        {
            RouteCollection routes = new RouteCollection();

         
            routes.MapRoute( "1", "X{controller}/{action}"  , new { controller = "Home", action = "Index" });
            routes.MapRoute("2", "{controller}/{action}", new { controller = "Home", action = "Index" });
            routes.MapRoute("3", "Public/{controller}/{action}", new { controller = "Home", action = "Index" });

            RouteTestHelper.TestRouteMatch(routes , "~/Xhome/Edit" , "Home" , "Edit");
        }


        [TestMethod]
        public void TestMethod2()
        {
            RouteCollection routes = new RouteCollection();

            //change order
            routes.MapRoute("2", "{controller}/{action}", new { controller = "Home", action = "Index" });

            routes.MapRoute("1", "X{controller}/{action}", new { controller = "Home", action = "Index" });
            routes.MapRoute("3", "Public/{controller}/{action}", new { controller = "Home", action = "Index" });

            RouteTestHelper.TestRouteMatch(routes, "~/Xhome/Edit" , "Xhome", "edit");
            //But do you have a xhome controller ?
        }
    }
}
